package com.phkj.qdh.repository

import com.phkj.qdh.bean.ApprovalManBean
import com.phkj.qdh.bean.CarKeyBean
import com.phkj.qdh.bean.UseCarBean
import com.phkj.qdh.bean.UseCarMyBean
import com.phkj.qdh.bean.UseCarMyDetail
import com.phkj.qdh.net.APPROVAL_MAN_LIST
import com.phkj.qdh.net.APP_LOGIN
import com.phkj.qdh.net.CAR_HAS_PERMISSION
import com.phkj.qdh.net.CAR_KEY_LIST
import com.phkj.qdh.net.CAR_USE_LIST
import com.phkj.qdh.net.CAR_USE_LIST_MY
import com.phkj.qdh.net.CAR_USE_MY_DETAIL
import com.phkj.qdh.net.CAR_USE_PROCESS
import com.phkj.qdh.net.CAR_USE_SUBMIT
import com.phkj.qdh.net.PageList
import rxhttp3.RxHttp
import rxhttp3.toFlowResponse

object CarRepository {

    fun hasPermission()=
        RxHttp.get(CAR_HAS_PERMISSION).toFlowResponse<Boolean>()


    fun useCarList(map: HashMap<String,Any?>)=
        RxHttp.postJson(CAR_USE_LIST).addAll(map).toFlowResponse<PageList<UseCarBean>>()


    fun useCarListMy(map: HashMap<String,Any?>)=
        RxHttp.get(CAR_USE_LIST_MY).addAll(map).toFlowResponse<PageList<UseCarMyBean>>()

    fun useCarDetailMy(map: HashMap<String,Any?>)=
        RxHttp.get(CAR_USE_MY_DETAIL).addAll(map).toFlowResponse<UseCarMyDetail>()

    fun carKeyList(map: HashMap<String,Any?>)=
        RxHttp.get(CAR_KEY_LIST).addAll(map).toFlowResponse<ArrayList<CarKeyBean>>()

    fun getApprovalManList()=
        RxHttp.get(APPROVAL_MAN_LIST).add("page",1).add("size",100).toFlowResponse<PageList<ApprovalManBean>>()


    fun useCarSubmit(map: HashMap<String,Any?>)=
        RxHttp.postJson(CAR_USE_SUBMIT).addAll(map).toFlowResponse<String>()


    fun carUseApproval(map: HashMap<String,Any?>)=
        RxHttp.postJson(CAR_USE_PROCESS).addAll(map).toFlowResponse<String>()

}